'''
author:
desc:
date:2019/11/29 14:21
'''
from conf.config import WEBPICTUREPATH
import os


class Tool:
	def error_picture(self):
		'''提供错误图片的,所有的图片的名字追加返回'''
		pictures = []
		# listdir 返回目录下的所有文件信息，返回值为list
		files = os.listdir(WEBPICTUREPATH)
		for file in files:
			if file.endswith('.jpg') or file.endswith('.png'):
				pictures.append((file,))  # HTMLTestRunner 需要的是[(),()]
		# 图片的绝对路径
		# for cur_dir,dirs,files in os.walk(WEBPICTUREPATH):
		# 	for file in files:
		# 		pictures.append(os.path.join(cur_dir,file))
		return pictures

if __name__ == '__main__':
	t = Tool()
	print(t.error_picture())